﻿using System;
using System.Resources;
using System.Collections;

namespace BizElements.Web
{
    /// <summary>
    /// Enumerates resource keys/names stored in a <see cref="IDictionary"/> object.
    /// </summary>
    internal class DictionaryResourceKeysReader : IResourceReader
    {
        IDictionary dictionary;

        /// <summary>
        /// Initializes a new instance of <b>DictionaryResourceKeysReader</b> class.
        /// </summary>
        /// <param name="dictionary">A <see cref="IDictionary"/> object that contains resource keys/names.</param>
        public DictionaryResourceKeysReader(IDictionary dictionary)
        {
            this.dictionary = dictionary;
        }

        /// <summary>
        /// Does nothing.
        /// </summary>
        public void Close()
        {
        }

        /// <summary>
        /// Returns an <see cref="IDictionaryEnumerator"/> object for the <see cref="IDictionary"/> object.
        /// </summary>
        /// <returns>An <see cref="IDictionaryEnumerator"/> object for the <see cref="IDictionary"/> object.</returns>
        public IDictionaryEnumerator GetEnumerator()
        {
            return this.dictionary.GetEnumerator();
        }

        /// <summary>
        /// Does nothing.
        /// </summary>
        public void Dispose()
        {
        }

        /// <summary>
        /// Returns an <see cref="IDictionaryEnumerator"/> object for the <see cref="IDictionary"/> object.
        /// </summary>
        /// <returns>An <see cref="IDictionaryEnumerator"/> object for the <see cref="IDictionary"/> object.</returns>
        IEnumerator IEnumerable.GetEnumerator()
        {
            return this.dictionary.GetEnumerator();
        }
    }
}
